package ai.people.netmon.framework.domain.gang.construction.entity;

import ai.people.netmon.framework.domain.gang.construction.request.LabelLibAccountExcel;
import ai.people.netmon.framework.domain.gang.construction.request.LabelLibAccountSaveOrUpdateRequest;
import com.alibaba.fastjson.annotation.JSONField;
import com.alibaba.fastjson.serializer.ToStringSerializer;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.NoArgsConstructor;

import java.io.Serializable;
import java.util.Date;

/**
 * <p>
 * 
 * </p>
 *
 * @author zhenglin
 * @since 2022-07-19
 */
@Data
@EqualsAndHashCode(callSuper = false)
@TableName(schema = "webservice")
@NoArgsConstructor
public class LabelLibAccount implements Serializable {

    private static final long serialVersionUID = 1L;

    /**
     * 主键ID
     */
    @JSONField(serializeUsing = ToStringSerializer.class)
    private Long id;

    /**
     * 标签ID
     */
    @JSONField(serializeUsing = ToStringSerializer.class)
    private Long labelLibId;

    /**
     * 平台
     */
    private String platform;

    /**
     * 账号
     */
    private String account;

    /**
     * 链接
     */
    private String url;

    /**
     * 创建时间
     */
    @JSONField(format = "yyyy-MM-dd HH:mm:ss")
    private Date createTime;

    /**
     * 更新时间
     */
    @JSONField(format = "yyyy-MM-dd HH:mm:ss")
    private Date updateTime;

    /**
     * 推荐id
     */
    @JSONField(serializeUsing = ToStringSerializer.class)
    private Long recommendId;


    public LabelLibAccount(LabelLibAccountSaveOrUpdateRequest request) {
        this.labelLibId = request.getLabelLibId();
        this.platform = request.getPlatform();
        this.account = request.getAccount();
        this.url = request.getUrl();
    }

    public LabelLibAccount(LabelLibAccountRecommend labelLibAccountRecommend, Long labelLibId) {
        this.labelLibId = labelLibId;
        this.platform = labelLibAccountRecommend.getPlatform();
        this.account = labelLibAccountRecommend.getAccount();
        this.url = labelLibAccountRecommend.getUrl();
        this.recommendId = labelLibAccountRecommend.getId();
    }

    public LabelLibAccount(LabelLibAccountExcel labelLibAccountExcel, Long labelLibId) {
        this.labelLibId = labelLibId;
        this.platform = labelLibAccountExcel.getPlatform();
        this.account = labelLibAccountExcel.getAccount();
        this.url = labelLibAccountExcel.getUrl();
    }
}
